class CreateTagPosts < ActiveRecord::Migration
  def self.up
    create_table :tag_posts do |t|
      t.column :post_id, :integer, :null => false
      t.column :tag_id, :integer, :null => false
      t.column :created_on, :datetime
      t.column :tagged_by, :string # user_id of the user who did the tagging
    end
    
    add_index :tag_posts, [:post_id, :tag_id], :unique => true
  end

  def self.down
    drop_table :tag_posts
  end
end
